package com.fxm.returns;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * @author fxm
 * @version V1.0.0
 * @description:
 * @date 2020/12/29 21:08
 */
@JsonInclude(JsonInclude.Include.NON_NULL)

public class RespEntity<T> {

    private Integer code;
    private String message;
    private T data;

    public RespEntity(){

    }

    public RespEntity(RespCode rc, T data) {
        this.code = rc.getCode();
        this.message = rc.getMessage();
        this.data = data;
    }

    public RespEntity(RespCode rc){
        this.code = rc.getCode();
        this.message = rc.getMessage();
    }

    public RespEntity(Integer code, String msg){
        this.code = code;
        this.message = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "RespEntity{" +
                "code=" + code +
                ", control='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
